home *** CD-ROM | disk | FTP | other *** search
- using System;
- using System.Collections;
- using GBPVR.Public;
-
- namespace gbweb.classes
- {
- public class DetailDisplay2
- {
- public static string getDetailDisplay(Programme programme)
- {
- string programUniqueIdentifier = programme.getUniqueProgrammeIdentifier();
- string description = programme.getDescription();
-
- //Check to see if the user uses the ExtendedEWA Extended database
- bool ExtendedEWAEnabled = ExtendedEWA.Initialize();
- if (ExtendedEWAEnabled)
- {
- //Open the ExtendedEWA DB
- ExtendedEWA.OpenExtendedEWADB();
- }
-
- //Add a line break if there is a description to provide seperation space
- if (description.Length > 0)
- {
- description = description + "<br>";
- }
-
- //Retrieve the rating for the show
- string rating = programme.getRating();
- if (rating != null && rating != "")
- {
- description = description + "<br>" + " Rated: " + programme.getRating();
- }
-
- //Add the show Genre to the line
- //set the label for the list of genre
- ArrayList genreCheck = programme.getGenreList();
- for (int unknownPos = genreCheck.BinarySearch("unknown", new CaseInsensitiveComparer()); unknownPos > -1;
- unknownPos = genreCheck.BinarySearch("unknown", new CaseInsensitiveComparer()))
- {
- genreCheck.RemoveAt(unknownPos);
- }
- for (int unknownPos = genreCheck.BinarySearch(string.Empty, new CaseInsensitiveComparer()); unknownPos > -1;
- unknownPos = genreCheck.BinarySearch(string.Empty, new CaseInsensitiveComparer()))
- {
- genreCheck.RemoveAt(unknownPos);
- }
- if (genreCheck.Count > 0)
- {
- description += "<br>Genre" + (genreCheck.Count > 1 ? "s" : string.Empty) + ": " + string.Join(", ", (string[])genreCheck.ToArray(typeof(string)));
- }
-
- // If the user has ExtendedEWA append additional information to the description when found
- if (ExtendedEWAEnabled)
- {
- // Pull the Airdate of the Show or the Release Year of the movie and the Start Rating for Movie
- string[] programInfo = ExtendedEWA.GetProgramInfo(programUniqueIdentifier);
-
- if (programInfo.Length > 0)
- {
- if (programUniqueIdentifier.StartsWith("MV"))
- {
- if (programInfo[0] != "0")
- {
- description += "<br> Movie Release Year: " + programInfo[0];
- }
- if (programInfo[2] != "none")
- {
- description += "<br> Star Rating: " + programInfo[2];
- }
- }
- else
- {
- if (programInfo[1] != "none")
- {
- description += "<br> Original Air Date: " + programInfo[1];
- }
- }
- }
-
- // Add HD indicator if available and user has selected to show it
- if (ExtendedEWA.IsHD(programUniqueIdentifier))
- {
- description += "<br> <div class=\"HD\" title=\"HD\">HD</div>";
- }
-
- // Provide a link to see Cast information
- description += "<br>" + "(<a href=\"Credits2.aspx?id=" + programme.getOID() +
- "\" onclick=\"EditPop2(this.href,'Add1');return false;\">Credits</a>)";
-
- //Check the ExtendedEWA supplemental database to see if the show is a new show
- if (ExtendedEWA.IsNew(programUniqueIdentifier))
- {
- //If show is a new show tag an indicator at the end of the description indicating so
- description += "<br><div class=\"new_show\" title=\"New episode\">New</div><br>";
- }
- //We need to check to see if the airdate is >= to today since the New show identifier is not reliable.
- //If the airdate is >= programme air date then we can assume it is a new show
- else if (programInfo.Length > 0)
- {
- if (!programUniqueIdentifier.StartsWith("MV"))
- {
- if (programInfo[1] != "none")
- {
- try
- {
- DateTime airDate = Convert.ToDateTime(programInfo[1]);
- if (airDate.Date >= programme.getStartTime().Date)
- {
- description += "<br><div class=\"new_show\" title=\"New episode\">New</div><br>";
- }
- }
- catch (Exception e)
- {
- }
- }
- }
- }
-
- //Close the ExtendedEWA DB
- ExtendedEWA.CloseExtendedEWADB();
- }
-
- return description;
- }
- }
- }
-